blob: 3e11e4fbb51f500442ec72145824a3753eac47d7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# eplXa is host end (local network bridge), eplXb is jail end.
# The corresponding pubnet interface is epwX, but that's not created for all jails.
{{ jail.name }} {
# STARTUP/LOGGING/VNET
vnet;
persist;
exec.clean;
exec.prestart = "ifconfig epair{{ jail.num }}000 create || echo 'Failed to create epair{{ jail.num }}000'";
exec.prestart += "ifconfig epair{{ jail.num }}000a name epl{{ jail.num }}a";
exec.prestart += "ifconfig epair{{ jail.num }}000b name epl{{ jail.num }}b";
exec.prestart += "ifconfig brlan0 addm epl{{ jail.num }}a";
{% if jail.name == "ingress" -%}
exec.prestart += "ifconfig epair{{ jail.num }}001 create || echo 'Failed to create epair{{ jail.num }}001'";
exec.prestart += "ifconfig epair{{ jail.num }}001a name epw1a";
exec.prestart += "ifconfig epair{{ jail.num }}001b name epw1b";
exec.prestart += "ifconfig brwan0 addm epw{{ jail.num }}a";
{% endif %}
exec.start = "/bin/sh /etc/rc";
exec.poststart = "ifconfig epl{{ jail.num }}b vnet ${name}";
exec.poststart += "jexec ${name} ifconfig epl{{ jail.num }}b up";
exec.poststart += "ifconfig epl{{ jail.num }}a up";
exec.poststart += "jexec ${name} ifconfig epl{{ jail.num }}b 192.168.2.{{ jail.num }}/16";
exec.poststart += "jexec ${name} route delete default || echo 'No default route to delete'";
{% if jail.name != "ingress" %}
{% for ing in jails -%}
{% if ing.name == "ingress" -%}
exec.poststart += "jexec ${name} route add default 192.168.2.{{ ing.num }} || echo 'Failed to add default route'";
{% endif %}
{% endfor %}
{% else %}
exec.poststart += "ifconfig epw{{ jail.num }}b vnet ${name}";
exec.poststart += "jexec ${name} ifconfig epw{{ jail.num }}b up";
exec.poststart += "ifconfig epw{{ jail.num }}a up";
exec.poststart += "jexec ${name} service dhclient restart epw{{ jail.num }}b";
{% endif %}
exec.stop = "/bin/sh /etc/rc.shutdown";
exec.poststop += "ifconfig epl{{ jail.num }}a destroy";
{% if jail.name == "ingress" -%}
exec.poststop += "ifconfig epw{{ jail.num }}a destroy";
{% endif %}
exec.consolelog = "/var/log/jail_console_${name}.log";
# PERMISSIONS
allow.raw_sockets;
exec.clean;
mount.devfs;
{%if jail.name == "postgres" -%}
allow.sysvipc;
devfs_ruleset = 5;
{% elif jail.name == "ingress" -%}
devfs_ruleset = 6;
{% else %}
devfs_ruleset = 4;
{% endif %}
# HOSTNAME/PATH
host.hostname = "${name}";
path = "/usr/local/jails/containers/${name}";
}
|